<template>
  <div class="app-container">
    <!-- 企业信息 -->
    <top :sqStatu="sqStatu" />
    <!-- <div class="header">
      <div class="logo">
        <div class="img">
          {{ companyName }}
        </div>
      </div>
      <div class="info">
        <div class="status">
          <div class="statusInfo" @mouseleave="isShowyc" @mouseenter="isShowyr">
            <span class="cursorCla">{{ comInfo.qymc }}</span
            >
            <span
              class="cursorCla cursorClaTwo"
              v-show="isShow"
              @click.stop="_copy(comInfo.qymc)"
            >
              <i class="el-icon-document-copy"></i>
              复制
            </span>
            <span
              :class="[
                { cx: comInfo.djzt == '存续' || comInfo.djzt == '在业' },
              ]"
              >{{ comInfo.djzt }}</span
            >
            <span class="pray">最近更新：{{ comInfo.updateTime }}</span>
          </div>
          <div>
            <el-button
              type="primary"
              size="small"
              v-show="isjk"
              @click="handelFxjKBtn"
              >风险监控</el-button
            >
            <el-button
              type="primary"
              size="small"
              @click="handelDeleteFxjkBtn"
              v-show="!isjk"
              >取消监控</el-button
            >
            <el-button
              type="primary"
              size="small"
              @click="downLoadRiskReport"
              v-has="'downRiskReport'"
              >下载风控报告</el-button
            >
            <el-button
              type="primary"
              size="small"
              @click="handelDy"
              v-if="!isdy"
              >订阅</el-button
            >
            <el-button
              type="primary"
              size="small"
              @click="handelDeleteDy"
              v-else
              >取消订阅</el-button
            >
            <el-button
              type="primary"
              size="small"
              style="margin-right: 12px"
              @click="goBack"
            >返回</el-button>
          </div>
        </div>
        <el-dialog
          title="监控详情指引"
          center
          :visible.sync="showDialog"
          width="40%"
          custom-class="dialog"
          :show-close="false"
          :close-on-click-modal="false"
          :close-on-press-escape="false"
        >
          <div class="intrMsg">
            <p class="introduce">您可在风险监控页面查看已监控企业的风险详情（点击“风险预警管理-风险监控”菜单即可进入风险监控页面）</p>
            <el-image
              class="img"
              :src="require('@/assets/jkxqzy.png')"
              :preview-src-list="srcList"
            ></el-image>
          </div>
          <div
            slot="footer"
            class="dialog-footer"
          >
            <el-button
              type="primary"
              @click="showDialog = false"
            >关闭</el-button>
          </div>
        </el-dialog>
        <div class="lables">
          <span @click="goLicense">{{ sqStatu }}</span>
          <span v-if="nsrType">{{ nsrType }}</span>
          <span>{{ comInfo.qylx }}</span>
          <el-popover
            placement="bottom"
            trigger="hover"
            v-model="busVisible"
            v-if="jyycData ? Object.keys(jyycData).length > 0 : ''"
          >
            <div>
              <p>列入经营异常名录</p>
              <p>列入时间：{{ jyycData.lrrq }}</p>
              <p>列入原因：{{ jyycData.yy }}</p>
            </div>
            <span slot="reference" class="tips" style="color: red"
              >经营异常</span
            >
          </el-popover>
          <el-popover
            placement="bottom"
            trigger="hover"
            v-model="nameVisible"
            v-if="cymList.length > 0"
          >
            <div style="text-align: center">
              <p v-for="(item, index) in cymList" :key="index">{{ item }}</p>
            </div>
            <span slot="reference" class="tips">曾用名</span>
          </el-popover>
          <span>{{ comInfo.sshy }}</span>
          <span
            v-for="(item, index) in labelList"
            :key="index"
            :style="{
              color: item.labelColor.color,
              backgroundColor: item.labelColor.backgroundColor,
            }"
            >{{ item.signName }}</span
          >
        </div>
        <div>
          <hr style="background-color: #e6e9f4; border: none; height: 1px" />
        </div>
        <div class="msg">
          <p>
            <span class="pray">法定代表人：</span
            ><span class="msgInfo">{{ comInfo.fddbr }}</span
            ><span
              @click="handelCheckCompany(comInfo.fddbr, comInfo.sfzjhm)"
              class="glqy"
            >
              关联企业></span
            >
          </p>
          <p>
            <span class="pray">{{ handelCode(comInfo.shtyxydm) }}</span
            ><span class="msgInfo">{{ comInfo.shtyxydm }}</span>
          </p>
          <p>
            <span class="pray">联系方式：</span
            ><span class="msgInfo">{{ comInfo.dh }}</span>
          </p>
          <p>
            <span class="pray">地址：</span
            ><span class="msgInfo">{{ comInfo.jycs }}</span>
          </p>
        </div>
      </div>
    </div> -->
    <div class="consensus">
      <div class="information">
        <p
          class="title"
          style="border-right: solid 2px #ccc; width: 8%"
        >
          企业动态
        </p>
        <div
          style="width: 80%; padding: 12px 0 12px 12px"
          v-if="opinionInfo.length > 0"
        >
          <el-carousel
            height="54px"
            direction="vertical"
            :autoplay="true"
            :loop="true"
            :interval="5000"
          >
            <el-carousel-item
              v-for="(item, index) in opinionInfo"
              :key="index"
            >
              <p
                style="line-height: 54px; margin: 0"
                class="yjxq"
              >
                <span style="margin-left: 12px">风险大类：{{ qylxFilter(item.fxdl,fxdlOptions)}}</span>
                <span style="margin-left: 12px">风险名称：{{ item.yjxl }}</span>
                <span style="margin-left: 12px">风险等级：{{ qylxFilter(item.yjdj,yjdjOptions) }}</span>
                <span style="margin-left: 12px">风险详情：{{ item.yjxq }}</span>
              </p>
            </el-carousel-item>
          </el-carousel>
        </div>
        <div
          v-else
          style="marginLeft:10px; fontSize:12px;"
        >暂无动态</div>
        <p
          :class="opinionInfo.length > 0 ? 'ckdt' : 'ckdtTwo'"
          style="margin-right: 12px; width: 8%; text-align: right"
          @click="handelCheckConsensus"
        >
          查看动态>>
        </p>
      </div>
      <div class="message">
        <div class="scoremsg">
          <el-popover
            placement="right"
            trigger="hover"
            v-model="visible"
          >
            <div style="text-align: right; margin: 0">
              <el-table
                :data="scoreData"
                style="width: 100%"
                :header-cell-style="{ background: '#f2f9fe' }"
              >
                <el-table-column
                  prop="range"
                  label="区间"
                  width="120"
                  align="center"
                ></el-table-column>
                <el-table-column
                  prop="level"
                  label="等级"
                  width="60"
                  align="center"
                ></el-table-column>
                <el-table-column
                  prop="des"
                  label="描述"
                  width="400"
                  align="center"
                ></el-table-column>
              </el-table>
            </div>
            <el-button
              slot="reference"
              class="tips"
            >评分含义</el-button>
          </el-popover>
          <div
            class="score"
            id="score"
          ></div>
        </div>
        <div class="risk">
          <div class="self">
            <p style="font-weight: 900;cursor: pointer;">
              自身风险:<span
                class="glqy"
                @click="handelClickSelf"
              >{{ zsfxSum }}条>></span>
            </p>
            <div class="riskType">
              <p
                v-for="(item, index) in zsfxData"
                :key="index"
              >
                <span :class="[item.num > 0 ? 'msgInfo' : 'pray']">{{ item.FXDL }}：<span :class="[item.num > 0 ? 'msgInfo' : 'pray']">{{ item.num }}条</span></span>
              </p>
              <!-- <p><span class="pray">风险大类2：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类3：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类4：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类5：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类6：<span class="msgInfo">1条</span></span></p> -->
            </div>
          </div>
          <div class="relative">
            <p style="font-weight: 900;cursor: pointer;">
              关联风险:<span
                class="glqy"
                @click="handelClickRelative"
              >{{ glSum }}条>></span>
            </p>
            <div class="riskType">
              <p
                v-for="(item, index) in glfxData"
                :key="index"
              >
                <span :class="[item.num > 0 ? 'msgInfo' : 'pray']">{{ item.FXDL }}：<span :class="[item.num > 0 ? 'msgInfo' : 'pray']">{{ item.num }}条</span></span>
              </p>
              <!-- <p><span class="pray">风险大类2：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类3：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类4：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类5：<span class="msgInfo">1条</span></span></p>
                            <p><span class="pray">风险大类6：<span class="msgInfo">1条</span></span></p> -->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="menu">
      <el-tabs
        v-model="activeName"
        class="m-el-tabs"
      >
        <el-tab-pane
          label="企业基本信息"
          name="first"
          v-if="qyjjxx"
        ></el-tab-pane>
        <!-- <el-tab-pane
          label="关联图谱"
          name="second"
          v-if="gltp"
        ></el-tab-pane> -->
        <el-tab-pane
          label="社保信息"
          name="eighth"
          v-if="sbgjj && sqStatu == '已授权'"
        ></el-tab-pane>
        <el-tab-pane
          label="社保信息"
          name="noEighth"
          v-else
        ></el-tab-pane>
        <el-tab-pane
          label="公积金信息"
          name="gjjInfo"
          v-if="gjjInfo && sqStatu == '已授权'"
        ></el-tab-pane>
        <el-tab-pane
          label="公积金信息"
          name="noGjjInfo"
          v-else
        ></el-tab-pane>
        <el-tab-pane
          label="税务信息"
          name="third"
          v-if="swxx"
        ></el-tab-pane>
        <el-tab-pane
          label="税务信息"
          name="noThird"
          v-else
        ></el-tab-pane>
        <!-- <el-tab-pane
          label="发票信息"
          name="fourth"
          v-if="fpxx"
        ></el-tab-pane> -->
        <!-- <el-tab-pane
          label="企业年报"
          name="ninth"
          v-if="qynb"
        ></el-tab-pane> -->
        <el-tab-pane
          label="经营信息"
          name="fifth"
          v-if="jjxx"
        ></el-tab-pane>
        <el-tab-pane
          label="生产信息"
          name="scinfo"
          v-if="scxx && sqStatu == '已授权'"
        ></el-tab-pane>
        <el-tab-pane
          label="生产信息"
          name="noScinfo"
          v-else
        ></el-tab-pane>
        <el-tab-pane
          label="法律信息"
          name="sixth"
          v-if="flxx"
        ></el-tab-pane>
        <el-tab-pane
          label="法律信息"
          name="noSixth"
          v-else
        ></el-tab-pane>
        <el-tab-pane
          label="知识产权"
          name="seventh"
          v-if="zscq"
        ></el-tab-pane>
      </el-tabs>
    </div>
    <div
      class="switch"
      v-has="'isTm'"
    >
      <span>金额是否脱敏：</span>
      <el-switch
        v-model="isTm"
        active-text="ON"
        inactive-text="OFF"
      ></el-switch>
    </div>
    <!-- 关联企业 -->
    <el-dialog
      :title="dialogName + '关联企业'"
      :visible.sync="dialogVisible"
      width="60%"
      custom-class="dialog"
    >
      <el-table
        :data="glData"
        style="width: 100%"
        :header-cell-style="{ background: '#f2f9fe' }"
      >
        <el-table-column
          type="index"
          label="序号"
          width="100"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="name"
          label="企业名称"
          width="300"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="status"
          label="状态"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="money"
          label="注册资本（万元）"
          width="150"
          align="center"
        >
          <template slot-scope="scope">
            <span v-show="isTm">{{deseHandler(scope.row.money)}}</span>
            <span v-show="!isTm">{{scope.row.money}}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="relative"
          label="关联关系"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="percent"
          label="持股比例"
          align="center"
        ></el-table-column>
      </el-table>
    </el-dialog>
    <!-- 授权协议 -->
    <el-dialog
      title="授权协议"
      :visible.sync="dialogLicense"
      width="540px"
      custom-class="dialog"
    >
      <el-image
        v-for="item in imgList"
        :key="item"
        style="width: 500px; height: 500px"
        :src="item"
        :preview-src-list="imgList"
      ></el-image>
    </el-dialog>
    <!-- 下载分控报告提示框 -->
    <el-dialog
      title=""
      :visible.sync="dialogVisible1"
      width="30%"
    >
      <p class="downMsg">
        您的下载申请稍后将提交至征信公司，审核通过后风控报告将发送至您的邮箱，请确认邮箱地址是否正确。
      </p>
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item
          label="邮箱 "
          prop="email"
        >
          <el-input
            v-model="ruleForm.email"
            style="width: 200px"
          ></el-input>
        </el-form-item>
      </el-form>
      <span
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="dialogVisible1 = false">取 消</el-button>
        <el-button
          type="primary"
          @click="submitForm"
        >确 定</el-button>
      </span>
    </el-dialog>
    <div class="main">
      <company-info
        v-if="activeName == 'first'"
        :qylxOptions="qylxOptions"
        :comInfo="comInfo"
        @handelCheckCompany="handelCheckCompany"
      ></company-info>
      <association-map
        v-if="activeName == 'second'"
        :comInfo="comInfo"
      ></association-map>
      <social-fund
        v-if="activeName == 'eighth'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></social-fund>
      <no-social-fund
        v-if="activeName == 'noEighth'"
        :comInfo="comInfo"
        :sbgjj="sbgjj"
        :sqStatu="sqStatu"
      ></no-social-fund>
      <tax-information
        v-if="activeName == 'third'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></tax-information>
      <no-tax-information
        v-if="activeName == 'noThird'"
        :comInfo="comInfo"
      ></no-tax-information>
      <invoice-information
        v-if="activeName == 'fourth'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></invoice-information>
      <annualReports
        v-if="activeName == 'ninth'"
        :comInfo="comInfo"
      ></annualReports>
      <business-information
        v-if="activeName == 'fifth'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></business-information>
      <energy-analysis
        v-if="activeName == 'scinfo'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></energy-analysis>
      <no-energy-analysis
        v-if="activeName == 'noScinfo'"
        :comInfo="comInfo"
        :scxx="scxx"
        :sqStatu="sqStatu"
      ></no-energy-analysis>
      <legal-information
        v-if="activeName == 'sixth'"
        :comInfo="comInfo"
      ></legal-information>
      <no-legal-information
        v-if="activeName == 'noSixth'"
        :comInfo="comInfo"
      ></no-legal-information>
      <intellectual-property
        v-if="activeName == 'seventh'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></intellectual-property>
      <accumulation-fund
        v-if="activeName == 'gjjInfo'"
        :comInfo="comInfo"
        :isTm="isTm"
      ></accumulation-fund>
      <no-accumulation-fund
        v-if="activeName == 'noGjjInfo'"
        :comInfo="comInfo"
        :gjjInfo="gjjInfo"
        :sqStatu="sqStatu"
      ></no-accumulation-fund>
    </div>
  </div>
</template>

<script>
// import { mapGetters } from "vuex";
import * as echarts from 'echarts'
import top from './header'
import companyInfo from './companyInfo'
import associationMap from './associationMap'
import socialFund from './socialFund'
import taxInformation from './taxInformation'
import invoiceInformation from './invoiceInformation'
import businessInformation from './businessInformation'
import legalInformation from './legalInformation'
import intellectualProperty from './intellectualProperty'
import annualReports from './annualReports'
import energyAnalysis from './energyAnalysis'
import accumulationFund from './accumulationFund'
import noSocialFund from '../unauthorized/noSocialFund'
import noAccumulationFund from '../unauthorized/noAccumulationFund'
import noTaxInformation from '../unauthorized/noTaxInformation'
import noEnergyAnalysis from '../unauthorized/noEnergyAnalysis'
import noLegalInformation from '../unauthorized/noLegalInformation'
import { getField, getRes, getOnRes } from '@/api/user.js'
import {
  moveToWhiteFormRecmd,
  getW,
  delW,
  getIsJk,
  deleteRelationship,
  addRelationship,
  getQYPushHistory,
  getQyfx,
} from '@/api/manager.js'
import {
  getCbInfo,
  getZsfx,
  getGlfx,
  relationCo,
  sqStatus,
  getScoring,
  getOpinionInfo,
  qySign,
  getUser,
  submitApprove,
  searchAuthByShtyxydm,
  jyyc,
  getZsfxPage,
  getqySign,
} from '@/api/portay'
import mixin from '@/views/roles/admin/work/mixin'

export default {
  components: {
    top,
    companyInfo,
    associationMap,
    socialFund,
    taxInformation,
    invoiceInformation,
    businessInformation,
    legalInformation,
    intellectualProperty,
    annualReports,
    energyAnalysis,
    accumulationFund,
    noSocialFund,
    noAccumulationFund,
    noTaxInformation,
    noEnergyAnalysis,
    noLegalInformation,
  },
  mixins: [mixin],
  data() {
    return {
      isShow: false,
      isTm: true,
      qyjjxx: true,
      gltp: true,
      swxx: false,
      fpxx: true,
      qynb: true,
      jjxx: true,
      scxx: false,
      flxx: false,
      zscq: true,
      sbgjj: false,
      gjjInfo: false,
      qqNewArray: [],
      comInfo: { updateTime: {} },
      companyName: undefined,
      shtyxydm: undefined,
      sqStatu: '',
      nsrType: undefined,
      qylxOptions: [],
      opinionInfo: [],
      activeName: 'first',
      dialogName: undefined,
      dialogVisible: false,
      dialogVisible1: false,
      ruleForm: {
        email: '',
      },
      rules: {
        email: [
          { required: true, message: '请输入邮箱', trigger: 'blur' },
          {
            type: 'email',
            message: '请输入正确的邮箱地址',
            trigger: ['blur', 'change'],
          },
        ],
      },
      glData: [],
      // 渲染已分配的权限id
      jurisdictionId: [],
      permission_routes: [],
      dialogLicense: false,
      imgList: [],
      dataHXFXDL: undefined,

      zsfxSum: 0,
      zsfxData: [],
      glSum: 0,
      gldxSum: 0,
      glfxData: [],
      isdy: false, //是否订阅
      isjk: true, //是否监控
      visible: false,
      scoreData: [
        {
          range: '0~40',
          des: '信用状况亟待改善，可能被列入严重失信主题名单',
          level: 'D',
        },
        {
          range: '40~70',
          des: '信用状况需要改善，可能存在严重失信行为',
          level: 'C',
        },
        {
          range: '70~80',
          des: '信用状况一般，有需要修复的轻微失信记录',
          level: 'B',
        },
        { range: '80~90', des: '信用状况良好', level: 'A' },
        { range: '90~100', des: '信用状况好，信守承诺', level: 'A+' },
      ],
      jyycData: {},
      busVisible: false,
      cymList: [],
      nameVisible: false,
      labelList: [],
      showDialog: false,
      srcList: [require('@/assets/jkxqzy.png')],
      fxdlOptions: [],
      yjdjOptions: [],
    }
  },
  filters: {
    dateFilter(val) {
      if (!val) return ''
      return val > 0 ? val : '0' + val
    },
  },
  computed: {
    // ...mapGetters(["permission_routes"]),
  },
  created() {
    let params = { page: 1, size: 100, code: 'QYLX' }
    getField(params).then((res) => {
      if (res.status) {
        this.qylxOptions = res.data.records.map((item) => {
          return { label: item.fieldName, value: item.fieldCode }
        })
      }
    })
    getField({ page: 1, size: 100, code: 'HXFXDL' }).then((res) => {
      if (res.status) {
        this.fxdlOptions = res.data.records.map((item) => {
          return { label: item.fieldName, value: item.fieldCode }
        })
      }
    })
    getField({ page: 1, size: 100, code: 'YJDJ' }).then((res) => {
      if (res.status) {
        this.yjdjOptions = res.data.records.map((item) => {
          return { label: item.fieldName, value: item.fieldCode }
        })
      }
    })
    //this.shtyxydm = this.$route.query.shtyxydm;
    this.comInfo = JSON.parse(sessionStorage.getItem('comInfo'))
    let index = this.comInfo.qymc.indexOf('淄博市')
    if (index == 0) {
      this.companyName = this.comInfo.qymc.substr(3, 4)
    } else {
      this.companyName = this.comInfo.qymc.substr(0, 4)
    }
    //this.getJyyc();
    this.cymList = this.comInfo.cym ? this.comInfo.cym.split(';') : []
    this.getQyFx()
    this.getSqStatus()
    //this.getqySign();
    this.getOpinionInfo()
    this.getScoring()
    //this.qySign();
    //this.getIsDy();
    //this.getIsJkBtn();
    /* getCbInfo({feilds:this.shtyxydm}).then(res=>{
            this.comInfo = res.data;
            let index = res.data.qymc.indexOf('淄博市');
            if(index==0){
                this.companyName = res.data.qymc.substr(3,4);
            }else{
                this.companyName = res.data.qymc.substr(0,4);
            }
            this.getQyFx();
            //this.getSqStatus();
            this.getOpinionInfo();
            this.getScoring();
            this.qySign();
        }) */

    // 企业基本信息按钮的隐藏与展示
    getOnRes({
      k: this.$store.getters.roleId,
    }).then((res) => {
      this.jurisdictionId = res.data
      // console.log(this.jurisdictionId)
      let qyparams = { page: 1, size: 10 }
      getRes(qyparams).then((res) => {
        if (res.status) {
          for (let i = 0; i < res.data.records.length; i++) {
            if (res.data.records[i].resVal == '企业画像') {
              for (let j = 0; j < res.data.records[i].children.length; j++) {
                if (
                  this.jurisdictionId.indexOf(
                    res.data.records[i].children[j].id
                  ) != -1
                ) {
                  this.qqNewArray.push(res.data.records[i].children[j].resVal)
                }
              }
              if (this.qqNewArray.indexOf('企业基本信息') != -1) {
                this.qyjjxx = true
              }
              if (this.qqNewArray.indexOf('关联图谱') != -1) {
                this.gltp = true
              }
              if (this.qqNewArray.indexOf('社保信息') != -1) {
                this.sbgjj = true
              }
              if (this.qqNewArray.indexOf('税务信息') != -1) {
                this.swxx = true
              }
              if (this.qqNewArray.indexOf('发票信息') != -1) {
                this.fpxx = true
              }
              if (this.qqNewArray.indexOf('企业年报') != -1) {
                this.qynb = true
              }
              if (this.qqNewArray.indexOf('经营信息') != -1) {
                this.jjxx = true
              }
              if (this.qqNewArray.indexOf('法律信息') != -1) {
                this.flxx = true
              }
              if (this.qqNewArray.indexOf('知识产权') != -1) {
                this.zscq = true
              }
              if (this.qqNewArray.indexOf('生产信息') != -1) {
                this.scxx = true
              }
              if (this.qqNewArray.indexOf('公积金信息') != -1) {
                this.gjjInfo = true
              }
            }
          }
        }
      })
    })
  },
  mounted() {
    //this.getCompanyScore();
  },
  methods: {
    qylxFilter(val, option) {
      if (!val) return ''
      return option
        .filter((item) => item.value == val)
        .map((ite) => ite.label)[0]
    },
    isShowyr() {
      this.isShow = true
    },
    isShowyc() {
      this.isShow = false
    },
    // 复制操作
    _copy(val) {
      this.$copyText(val).then(() => {
        this.$message.success('复制成功')
      })
    },

    //判断是否为统一社会信用代码
    handelCode(val) {
      if (val.length == 18 && val.startsWith('91')) {
        return '统一社会信用代码：'
      } else {
        return '工商注册号：'
      }
    },
    //获取是否已经监控
    getIsJkBtn() {
      getIsJk({ shtyxydm: this.comInfo.shtyxydm }).then((res) => {
        if (res.status) {
          if (res.data === 'N') {
            this.isjk = true
          } else {
            this.isjk = false
          }
        }
      })
    },
    //监控
    handelFxjKBtn() {
      let params = { shtyxydm: this.comInfo.shtyxydm }
      addRelationship(params).then((res) => {
        if (res.status) {
          this.isjk = false
          this.$message({
            type: 'success',
            message: `${res.msg}`,
          })
          let param = {
            pageNum: 1,
            pageSize: 10,
            startTime: '',
            endTime: '',
            qymc: '',
          }
          getQYPushHistory(param).then((result) => {
            if (result.status) {
              this.showDialog = Number(result.data.total) == 1 ? true : false
            }
          })
        } else {
          this.$message({
            type: 'error',
            message: `${res.msg}`,
          })
        }
      })
    },
    //取消监控
    handelDeleteFxjkBtn() {
      let params = { shtyxydm: this.comInfo.shtyxydm }
      deleteRelationship(params).then((res) => {
        if (res.status) {
          this.isjk = true
          this.$message({
            type: 'success',
            message: `${res.msg}`,
          })
        } else {
          this.$message({
            type: 'error',
            message: `${res.msg}`,
          })
        }
      })
    },
    //查看是否已订阅
    getIsDy() {
      getW({ shtyxydm: this.comInfo.shtyxydm }).then((res) => {
        if (res.status) {
          if (res.data.records.length > 0) {
            this.isdy = true
          } else {
            this.isdy = false
          }
        } else {
          this.$message({
            type: 'error',
            message: `${res.msg}`,
          })
        }
      })
    },
    //订阅
    handelDy() {
      moveToWhiteFormRecmd(this.comInfo.shtyxydm).then((res) => {
        if (res.status) {
          this.isdy = true
          this.$message({
            type: 'success',
            message: `${res.msg}`,
          })
        } else {
          this.$message({
            type: 'error',
            message: `${res.msg}`,
          })
        }
      })
    },
    //取消订阅
    handelDeleteDy() {
      delW({
        shtyxydm: this.comInfo.shtyxydm,
      }).then((res) => {
        if (res.status) {
          this.isdy = false
          this.$message({
            type: 'success',
            message: `${res.msg}`,
          })
        } else {
          this.$message({
            type: 'error',
            message: res.msg,
          })
        }
      })
    },
    //经营异常
    getJyyc() {
      jyyc({
        TYSHXYDM: this.comInfo.shtyxydm,
      }).then((res) => {
        if (res.status) {
          this.jyycData = res.data
        }
      })
    },
    //查看企业授权
    goLicense() {
      if (this.sqStatu == '已授权') {
        let params = {
          shtyxydm: this.comInfo.shtyxydm,
        }
        this.imgList = []
        searchAuthByShtyxydm(params).then((res) => {
          this.dialogLicense = true
          //this.licenseData = res.data;
          res.data.fileList.map((item) => {
            return this.run(item.base64Code, res.data.printBk)
          })
        })
        /*let comInfo = this.comInfo;
                this.$router.push({ path: '/portray1/license',query:{shtyxydm:comInfo.shtyxydm,page:'companyMessage'}});*/
      } else {
        this.$message({
          message: `企业未授权`,
          type: 'warning',
        })
      }
    },
    // 添加水印1
    async run(imgUrl, markText) {
      // 1.图片路径转成canvas
      const tempCanvas = await this.imgToCanvas(imgUrl)
      // 2.canvas添加水印
      //const markText = '我是水印'
      const canvas = this.addWatermark(tempCanvas, markText)
      // 3.canvas转成img
      const img = this.convasToImg(canvas)
      // 查看效果
      this.imgList.push(img.src)
    },
    submitForm() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          let params = {
            qyshxydm: this.comInfo.shtyxydm,
            recvEmail: this.ruleForm.email,
          }
          submitApprove(params).then((res) => {
            this.dialogVisible1 = false
            if (res.status) {
              this.$message({
                type: 'success',
                message: res.msg,
              })
            } else {
              this.$message({
                type: 'error',
                message: res.msg,
              })
            }
          })
        }
      })
    },
    goBack() {
      this.$router.go(-1)
      //this.$router.push({ path: '/portray1/index'});
    },
    //纳税人标识
    qySign() {
      qySign({ TYSHXYDM: this.comInfo.shtyxydm }).then((res) => {
        if (res.data.length > 0) {
          this.nsrType = res.data[0].aji == '是' ? 'A级纳税人' : undefined
        } else {
          this.nsrType = undefined
        }
      })
    },
    //企业授权状态
    getSqStatus() {
      sqStatus({ TYSHXYDM: this.comInfo.shtyxydm }).then((res) => {
        this.sqStatu = res.data
      })
    },
    getqySign() {
      getqySign({ TYSHXYDM: this.comInfo.shtyxydm }).then((res) => {
        // this.sqStatu = res.data;
        this.labelList = res.data ? res.data : []
        if (this.labelList.length > 0) {
          this.labelList.forEach((item) => {
            if (item.signNature == '中性标签') {
              // item.labelColor = {color:'#5590f4',backgroundColor: '#eaf1fb'}
              item.labelColor = {
                color: '#5da188',
                backgroundColor: '#dff7ea',
              }
            } else if (item.signNature == '正向标签') {
              item.labelColor = {
                color: '#5da188',
                backgroundColor: '#dff7ea',
              }
            } else {
              item.labelColor = {
                color: '#d77c61',
                backgroundColor: '#eaf1fb',
              }
            }
          })
        }
      })
    },
    //企业动态信息
    getOpinionInfo() {
      let params = {
        qymc: this.comInfo.qymc,
        pageSize: 10,
        pageNum: 1,
      }
      getQyfx(params).then((res) => {
        if (res.status) {
          this.opinionInfo = res.data.records
        }
      })
      /* getOpinionInfo({TYSHXYDM:this.comInfo.shtyxydm}).then(res=>{
                this.opinionInfo = res.data;
            }); */
    },
    //企业风险
    async getQyFx() {
      this.zsfxData = []
      this.glfxData = []
      const dataHXFXDL = await this.$store.dispatch('asyncApi/getDict', {
        code: 'HXFXDL',
      })
      //自身风险
      let zsData = await getZsfx({ tyshxydm: this.comInfo.shtyxydm })
      this.zsfxSum = zsData.data ? zsData.data.sum : 0
      let zsDataList = zsData.data ? zsData.data.list : []
      //关联风险
      const glData = await getGlfx({ tyshxydm: this.comInfo.shtyxydm })
      this.glSum = glData.data ? glData.data.sum : 0
      this.gldxSum = glData.data !== null ? glData.data.list : []
      let glDataListTwo = glData.data !== null ? glData.data.list : []
      dataHXFXDL.map((item1) => {
        let zsindex = zsDataList.findIndex((ite1) => ite1.FXDL == item1.label)
        if (zsindex > -1) {
          let newV = zsDataList[zsindex]
          this.zsfxData.push({ ...newV, code: item1.value })
        } else {
          this.zsfxData.push({ FXDL: item1.label, code: item1.value, num: 0 })
        }
      })
      dataHXFXDL.map((item2) => {
        let glindex = glDataListTwo.findIndex(
          (ite2) => ite2.FXDL == item2.label
        )
        if (glindex > -1) {
          let newW = glDataListTwo[glindex]
          this.glfxData.push({ ...newW, code: item2.value })
        } else {
          this.glfxData.push({ FXDL: item2.label, code: item2.value, num: 0 })
        }
      })
    },
    //查看关联企业
    handelCheckCompany(name, sfz) {
      this.dialogName = name
      this.dialogVisible = true
      relationCo({ sfz: sfz }).then((res) => {
        if (res.status) {
          this.dialogName = name
          this.dialogVisible = true
        }
      })
    },
    //下载风控报告
    downLoadRiskReport() {
      let userId = localStorage.getItem('username')
      getUser({ userId }).then((res) => {
        this.dialogVisible1 = true
        this.ruleForm.email = res.data.userEmail
      })
      /* let comInfo = this.comInfo;
            this.$router.push({ path: '/portray1/riskReport',query:{shtyxydm:comInfo.shtyxydm}}); */
    },
    //查看全部舆情
    handelCheckConsensus() {
      if (!this.opinionInfo.length > 0) return
      /* let comInfo = this.comInfo;
            this.$router.push({ path: '/portray1/consensus',query:{shtyxydm:comInfo.shtyxydm,page:'companyMessage'}}); */
      let zsfxData = this.zsfxData
      this.$router.push({
        path: '/portray1/selfRisk',
        query: { zsfxData: zsfxData },
      })
    },
    //企业得分
    getScoring() {
      getScoring({ TYSHXYDM: this.comInfo.shtyxydm }).then((res) => {
        console.log('getScoring',res)
        if (res.status) {
          let score = res.data ? res.data.score : null
          let level = res.data ? res.data.level : null
          this.$nextTick(() => {
            this.getCompanyScore(score,level)
          })
        }
      })
    },
    //自身风险
    handelClickSelf() {
      let zsfxData = this.zsfxData
      this.$router.push({
        path: '/portray1/selfRisk',
        query: { zsfxData: zsfxData },
      })
    },
    //关联风险
    handelClickRelative() {
      let glfxData = this.glfxData
      let glSum = this.glSum
      let gldxSum = this.gldxSum
      this.$router.push({
        path: '/portray1/relativeRisk',
        query: { glSum: glSum, gldxSum: gldxSum, glfxData: glfxData },
      })
    },
    //企业评分
    getCompanyScore(score, level) {
      var chartDom = document.getElementById('score')
      var scoreChart = echarts.init(chartDom)
      var option

      option = {
        title: {
          text: '企业评分',
        },
        series: [
          {
            type: 'gauge',
            splitNumber: 5,
            max: 100,
            center: ['45%', '60%'],
            axisLine: {
              lineStyle: {
                width: 15,
                color: [
                  [
                    1,
                    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                      {
                        offset: 0.4,
                        color: '#b2ddfc',
                      },
                      {
                        offset: 0.8,
                        color: '#209dff',
                      },
                      {
                        offset: 1,
                        color: '#0c93ff',
                      },
                    ]),
                  ],
                ],
              },
            },
            pointer: {
              show: false,
              itemStyle: {
                color: 'auto',
              },
            },
            axisTick: {
              distance: -30,
              length: 8,
              lineStyle: {
                color: '#fff',
                width: 2,
              },
            },
            splitLine: {
              distance: -30,
              length: 30,
              lineStyle: {
                color: '#fff',
                width: 4,
              },
            },
            axisLabel: {
              color: '#3faafe',
              distance: 20,
              fontSize: 10,
              fontStyle: 'oblique',
            },
            detail: {
              valueAnimation: true,
              offsetCenter: [0, 30],
              formatter: function (value) {
                let str =
                  score && level
                    ? `{a|${score}}\n{b|${level}}\n{x|综合评分}`
                    : `{a|暂无}\n{b|}\n{x|综合评分}`
                return str
              },
              rich: {
                a: {
                  fontSize: 20,
                  fontWeight: 900,
                  color: '#1497ff',
                },
                b: {
                  fontSize: 18,
                  fontWeight: 700,
                  color: '#68bfff',
                },
                x: {
                  fontSize: 16,
                },
              },
            },
            data: [
              {
                value: score,
              },
            ],
          },
        ],
      }
      option && scoreChart.setOption(option)
      window.addEventListener('resize', () => {
        scoreChart.resize()
      })
    },
  },
}
</script>

<style scoped="scoped" lang="scss">
.msgInfo {
  color: #000;
}
.pray {
  color: #a6a6a6;
}
::v-deep .el-tabs__item {
  box-shadow: none !important;
}
.app-container {
  background: #f0f0f0;
  padding: 24px;
  font-size: 14px;
}
/* 企业动态 */
.consensus {
  background: #f2f9fe;
  border-radius: 10px;
  width: 100%;
  height: 328px;
  margin-top: 20px;
  .information {
    height: 54px;
    padding-left: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    .title {
      font-size: 20px;
      width: 130px;
      font-style: italic;
      color: #4486f4;
      font-weight: 900;
    }
    .ckdt {
      position: absolute;
      right: 0;
      color: #4a8bf6;
      cursor: pointer;
    }
    .ckdtTwo {
      position: absolute;
      right: 0;
      color: #ccc;
      cursor: pointer;
    }
  }
  .message {
    width: 100%;
    height: 274px;
    border-radius: 0 0 10px 10px;
    padding: 28px 0 28px 22px;
    background: #fff;
    display: flex;
    align-items: center;
    .scoremsg {
      position: relative;
      width: 20%;
      top: -110px;
      #score {
        position: absolute;
        z-index: 0;
        width: 316px;
        height: 216px;
      }
      .tips.el-button {
        position: absolute;
        z-index: 1;
        right: 10px;
      }
    }
    .risk {
      width: 80%;
      height: 216px;
      border-left: 1px solid #e6e9f4;
      .self,
      .relative {
        padding-left: 48px;
      }
      .self {
        height: 107px;
        width: 100%;
        border-bottom: 1px solid #e6e9f4;
      }
      .riskType {
        display: flex;
        p {
          margin-right: 50px;
        }
      }
    }
  }
}
.yjxq {
  white-space: nowrap;
  overflow: hidden; //超出隐藏
  text-overflow: ellipsis; //溢出显示省略号
}
.menu {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  padding-left: 24px;
  margin-top: 20px;
}
.downMsg {
  width: 100%;
  text-indent: 2em;
  font-size: 16px;
}
</style>
<style>
.dialog {
  border-radius: 10px;
  padding-bottom: 50px;
}
.el-dialog {
  display: flex;
  flex-direction: column;
  margin: 0 !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /*height:600px;*/
  max-height: calc(100% - 200px);
  max-width: calc(100% - 30px);
}
.el-dialog .el-dialog__body {
  flex: 1;
  overflow: auto;
}
.m-el-tabs::v-deep.el-tabs__item:focus.is-active.is-focus:not(:active) {
  box-shadow: 0 0;
  border-radius: 0;
}
.introduce {
  font-size: 20px;
  text-indent: 2em;
  line-height: 30px;
  text-align: justify;
}
.switch {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  padding: 12px 174px 12px 24px;
  margin-top: 20px;
}
</style>
<!-- <style lang="scss">
.m-el-tabs::v-deep.el-tabs__item:focus.is-active.is-focus:not(:active) {
  box-shadow: 0 0;
  border-radius: 0;
}
.m-el-tabs {
  .el-tabs header {
    .el-tabs__nav-wrap {
      .el-tabs__nav-scroll {
        .el-tabs_nav {
          .el-tabs__item {
            box-shadow: none !important;
          }
        }
      }
    }
  }
}
</style> -->